#define _CRT_SECURE_NO_WARNINGS 1

#include<iostream>
#include<vector>
#include<algorithm>
#include<unordered_map>

using namespace std;

int minMovesToSeat(vector<int>& seats, vector<int>& students) {
    sort(seats.begin(), seats.end());
    sort(students.begin(), students.end());
    int res = 0;
    for (int i = 0; i < seats.size(); i++)
        res += abs(seats[i] - students[i]);
    return res;
}

int findPermutationDifference(string s, string t) {
    int res = 0;
    unordered_map<char, int> m;
    for (int i = 0; i < s.size(); i++) m[s[i]] = i;

    for (int i = 0; i < t.size(); i++)
        res += abs(m[t[i]] - i);
    return res;
}